﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace QuanLyThuoc
{
    class ThuocBac:Thuoc
    {
        string tinhThuoc; //tính hàn, lương, nhiệt, ôn, bình
        string nguyenLieu;
        public string TinhThuoc
        {
            get { return tinhThuoc; }
            set { tinhThuoc = value; }
        }
        public string NguyenLieu
        {
            get { return nguyenLieu; }
            set { nguyenLieu = value; }
        }

        public ThuocBac() : base() 
        { }

        public ThuocBac(string maThuoc, string tenThuoc, decimal giaBan, string congDung, string cachDung, string chongChiDinh, DateTime hanSuDung, string maNhomThuoc, string tinhThuoc, string viThuoc, string nguyenLieu):base(maThuoc, tenThuoc, giaBan, congDung, cachDung, chongChiDinh, hanSuDung, maNhomThuoc)
        {
            this.tinhThuoc = tinhThuoc;
            this.nguyenLieu = nguyenLieu;
        }

        public override void NhapThuoc()
        {
            base.NhapThuoc();
            Console.Write("Nhap tinh thuoc: ");
            tinhThuoc = Console.ReadLine();
            Console.Write("Nhap nguyen lieu: ");
            nguyenLieu = Console.ReadLine();
        }

        public override void XuatThuoc()
        {
            base.XuatThuoc();
            Console.WriteLine("-Tinh thuoc: " + tinhThuoc);
            Console.WriteLine("-Nguyen lieu: " + nguyenLieu);
            Console.WriteLine("---------------------------------------");
        }

        //ghi file
        public override void ghiFile()//???
        {
            FileStream file = new FileStream("DSThuoc.txt", FileMode.Append);
            BinaryWriter bWriter = new BinaryWriter(file);
            bWriter.Write(2);//2???
            bWriter.Close();
            file.Close();
            base.ghiFile();
            FileStream file2 = new FileStream("DSThuoc.txt", FileMode.Append);
            BinaryWriter bWriter2 = new BinaryWriter(file2);
            bWriter2.Write(tinhThuoc);
            bWriter2.Write(nguyenLieu);
            bWriter2.Close();
            file2.Close();
        }
    }
}
